<?php
# ***** BEGIN LICENSE BLOCK *****
# This file is part of "myWiWall".
# Copyright (c) 2007-2008 CRP Henri Tudor and contributors.
# All rights reserved.
#
# "myWiWall" is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
# 
# "myWiWall" is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with "myWiWall"; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# ***** END LICENSE BLOCK *****

class AdminMisc
{
	public function index()
	{
		// Session message handling.
		if (isset($_SESSION['message']))
		{
			$message = $_SESSION['message'];
			$isError = $_SESSION['isError'];
			
			// We consider message and isError session variables as flash variables.
			unset($_SESSION['message']);
			unset($_SESSION['isError']);
		}
		
		$organizationName = Miscellaneous::retrieveOrganizationName();
		$widgetManagement = true;
		
		$partial = 'misc';
		
		require (DefaultFC::getView('admin.tpl'));
	}
	
	public function editOrganizationName($organizationName)
	{
		try
		{
			Miscellaneous::editOrganizationName($organizationName);
			
			$_SESSION['isError'] = false;
			$_SESSION['message'] = __("The organization name was successfuly changed.");
		}
		catch(Exception $e)
		{
			$_SESSION['isError'] = true;
			$_SESSION['message'] = __("An error occured when changing the organization name.");
		}
		
		DefaultFC::redirection('adminMisc/index');
	}
}
?>